package com.chrray.position.auth;

import com.alibaba.fastjson.annotation.JSONField;
import com.chrray.position.enums.YesNoEnum;
import com.chrray.position.enums.app.FdUserRoleEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class Authentication {
    private String token;
    private Long userId;
    /**微信id*/
    private String wxId;
    @ApiModelProperty(value = "当前登录身份: 雇工-0,雇主-1")
    private Integer currentRole;
    private Integer realNamed;
    @ApiModelProperty(value = "是否已企业实名认证: 1-已经实名,0-未实名")
    private Integer entRealNamed;
    @ApiModelProperty(value = "是否已个人实名认证: 1-已经实名,0-未实名")
    private Integer personalRealNamed;



    @JSONField(serialize = false)
    public boolean isWorker() {
        return FdUserRoleEnum.WORKER.getValue().equals(currentRole);
    }

    @JSONField(serialize = false)
    public boolean isBoss() {
        return FdUserRoleEnum.BOSS.getValue().equals(currentRole);
    }

    @JSONField(serialize = false)
    public boolean isRealNamed() {
        return YesNoEnum.YES.getCode().equals(realNamed);
    }

    @JSONField(serialize = false)
    public boolean isEntRealNamed() {
        return YesNoEnum.YES.getCode().equals(entRealNamed);
    }

    @JSONField(serialize = false)
    public boolean isPersonalRealNamed() {
        return YesNoEnum.YES.getCode().equals(personalRealNamed);
    }



}
